package com.cn.ant.modules.wechat.service;

import com.cn.ant.common.persistence.Page;
import com.cn.ant.common.service.BaseService;
import com.cn.ant.modules.wechat.dao.WeixinExpandconfigMapper;
import com.cn.ant.modules.wechat.entity.WeixinExpandconfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
/**
 * 微信接口扩展类Service
 * @author AntDream
 * @version 2015-03-23
 */
@Component
@Transactional(readOnly = true)
public class WeixinExpandconfigService extends BaseService {

	@Autowired
	private WeixinExpandconfigMapper weixinExpandconfigMapper;
	
	public WeixinExpandconfig get(String id) {
		return weixinExpandconfigMapper.get(id);
	}
	
	public Page<WeixinExpandconfig> find(Page<WeixinExpandconfig> page, Map<String,Object> param) {
        param.put("startIdx", page.getFirstResult());
        param.put("pageSize", page.getPageSize());
        page.setList(weixinExpandconfigMapper.query(param));
        page.setCount(weixinExpandconfigMapper.queryCount(param));
        return page;
	}

    public List<WeixinExpandconfig> queryAll() {
        return weixinExpandconfigMapper.queryAll();
    }

    @Transactional(readOnly = false)
	public void save(WeixinExpandconfig weixinExpandconfig) {
		weixinExpandconfigMapper.insert(weixinExpandconfig);
	}
	
	@Transactional(readOnly = false)
	public void update(WeixinExpandconfig weixinExpandconfig) {
		weixinExpandconfigMapper.update(weixinExpandconfig);
	}
	
	@Transactional(readOnly = false)
	public void delete(String id) {
		weixinExpandconfigMapper.delete(id);
	}
	
}
